<template>
  <div class="login"></div>
</template>

<script>
import { mockUser } from '@/utils/mockUser';

export default {
  name: 'Login',
  created () {
    this.$toast.loading({
      message: '登录中...',
      forbidClick: true,
      duration: 0
    });
    this.$once('hook:beforeDestroy', () => this.$toast.clear());
    if (process.env.NODE_ENV !== 'production') {
      this.$store.commit('user/setUserInfo', {
        isLogin: true,
        ...mockUser
      });
      this.$router.push('/home');
    } else {
      this.$dd.login().then(() => {
        this.$router.push('/home');
      });
    }
  }
};
</script>
